Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WildFly - ConcurrentHashMap over synchronized collections and some improvements #6602

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

pepness
Copy link
Member

@pepness pepness commented Oct 20, 2023

NetBeans Module Notes:

  • Prefer ConcurrentMap to synchronizedMap
  • Prefer ConcurrentHashMap.newKeySet to synchronizedSet
  • Remove synchronized blocks when using atomic and concurrent operations
    with ConcurrentHashMap
  • Add Wildfly version 29 and 30
  • Add Java 21 support for Wildfly 30+
  • Close resources with try-with-resources when possible
  • Set initial capacity for profile sets
  • Bump source and target to version 11 (will revert if tests are red)

Testing:

  • Full build done
  • Verify successful execution of ant verify-libs-and-licenses
  • Verify successful execution of ant check-sigtests-release
  • Verify successful execution of ant -Dcluster.config=release commit-validation
  • Successfully register WildFly versions 29 and 30, create a Jakarta EE 10 WebApp and run it

WildFly 30 Release Notes

@pepness pepness added Java EE/Jakarta EE [ci] enable enterprise job enterprise [ci] enable enterprise job ci:all-tests [ci] enable all tests labels Oct 20, 2023
@pepness pepness added this to the NB21 milestone Oct 20, 2023
@pepness pepness self-assigned this Oct 20, 2023
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane to me.

@@ -21,7 +21,8 @@ auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterLocatio
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.enableFormatAsSaveAction=false
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.showNotifications=true
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.useProjectSettings=false
javac.source=1.8
javac.source=11
javac.target=11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed? From my POV we should keep changes to javac.* to a minimum and only bump when needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not needed. Reverting and then merging.

- Add Java 21 support for Wildfly 30+
- Prefer ConcurrentMap to synchronizedMap
- Prefer ConcurrentHashMap.newKeySet to synchronizedSet
- Remove synchronized blocks when using atomic and concurrent operations
  with ConcurrentHashMap
- Set initial capacity for profile sets
- Use try-with-resources when possible
@pepness pepness merged commit 5e2a225 into apache:master Oct 21, 2023
private static final Map<InstanceProperties, Boolean> PROPERTIES_TO_IS_RUNNING
= Collections.synchronizedMap(new WeakHashMap());
private static final ConcurrentMap<InstanceProperties, Boolean> PROPERTIES_TO_IS_RUNNING
= new ConcurrentHashMap(new WeakHashMap());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, isn't this very different than the original?

new ConcurrentHashMap(new WeakHashMap()) -> just creates a new ConcurrentHashMap, giving new WeakHashMap (empty map) as a parameter does nothing.

Collections.synchronizedMap(new WeakHashMap()) actually creates a synchronized version of WeakHashMap.

If ConcurrentHashMap is used, one must change the usage so that the keys inserted in the map are weak references. IF the original behavior is wanted. Right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right - would you be willing to create a PR for your suggested fix?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right - would you be willing to create a PR for your suggested fix?

I think it is faster if you guys do it. You can choose the preferred implementation also :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #6872

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:all-tests [ci] enable all tests enterprise [ci] enable enterprise job Java EE/Jakarta EE [ci] enable enterprise job
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants